﻿<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="Menu.ascx.vb" Inherits="TecnoHouse.Menu" %>
<%@ Register Assembly="Trirand.Web" Namespace="Trirand.Web.UI.WebControls" TagPrefix="cc1" %>
<script type="text/javascript">
    $(function() {

        // $("#radioset").buttonset();

        $("#slider").slider({
            range: true,
            min: 0,
            max: 300000,
            step: 25000,
            values: [0, 300000],
            slide: function(event, ui) {
                upperLimit = (ui.values[1] < 300000) ? ("€ " + $().number_format(ui.values[1], { numberOfDecimals: 0 })) : "nessun limite";
                var val0 = $().number_format(ui.values[0], { numberOfDecimals: 0 });
                $("#amount").val("Prezzo: da € " + val0 + " a " + upperLimit);
            }
        });

        $("#amount").val("Prezzo: da € " + $("#slider").slider("values", 0) +
			    " a nessun limite");

        $("#btnsearch").click(function() {
            $contract = $("input[name=radio]:checked").val();
            $immobile = $("#<%=ddlTipoImmobile.ClientID %>").val();
            $comune = $("#hfcomune").val();
            window.location = "/GUI/CercaAnnunci.aspx?contratto=" + $contract + "&immobile=" + $immobile + "&comune=" + $comune +
                                "&prezzoDa=" + $("#slider").slider("values", 0) + "&prezzoA=" + $("#slider").slider("values", 1);
        });

        $("#comune").autocomplete({
            source: function(request, response) {
                $.ajax({
                    url: '/BLL/hndSearch.ashx',
                    type: "GET",
                    dataType: "json",
                    data: {
                        op: "GetComuni",
                        limit: 10,
                        query: request.term
                    },
                    success: function(data) {
                        response($.map(data, function(item) {
                            return {
                                label: item.comune,
                                value: item.comune,
                                id: item.idcomune
                            }
                        }))
                    }
                })
            },
            minLength: 3,
            select: function(event, ui) {
                $("#hfcomune").val(ui.item.id);
            }
        });

    });
</script>
<div class="sidebar">
<ul id="nav" class="nav" runat="server">
    <li><a id="lnkdefault" runat="server" href="/Default.aspx" class="current">home</a></li>
   <%-- <li><a id="lnkelencoannunci" runat="server" href="/GUI/ElencoAnnunci.aspx" class="animate">annunci</a></li>--%>
    <li><a id="lnkservizi" runat="server" href="/GUI/Servizi.aspx" class="animate">servizi</a></li>
    <li><a id="lnkdove" runat="server" href="/GUI/Dove.aspx" class="animate">dove siamo</a></li>
    <%--<li><a id="lnklavoro" runat="server" href="/GUI/Lavoro.aspx" class="animate">lavoro</a></li>--%>
    <li><a id="lnkcontatti" runat="server" href="/GUI/Contatti.aspx" class="animate">contatti</a></li>
 </ul>
 <div class="indent">
    <!-- sm-box begin -->
    <div class="sm-box">
       <div class="top"></div>
       <div class="inner alt">
            <h3>Cerca Immobile</h3>
            <div>
            <div id="radioset">
                <input type="radio" id="radioAffitto" name="radio" value="1" checked="checked" /><label for="radioAffitto">Affitto</label>
                <input type="radio" id="radioVendita" name="radio" value="2" /><label for="radioVendita">Vendita</label>
            </div>
            <div class="clearer"></div>
            <input id="comune" type="text" name="comune" value="" class="watermark" title="Digita il comune"/>
            <input id="hfcomune" type="hidden"  name="hfcomune" value="" />
            <div class="clearer"></div>
            <asp:DropDownList ID="ddlTipoImmobile" runat="server" DataTextField="Descrizione" DataValueField="ID">
            </asp:DropDownList>
            <div class="clearer"></div>
            <input id="amount" type="text"/><br />
            <div id="slider"></div>
            <div class="clearer" style="height: 20px;"></div>
            <a id="btnsearch" href="#" class="fg-button fg-button-icon-left ui-state-default ui-corner-all">
                <span class="ui-icon ui-icon-search"></span>cerca</a>
            <div class="clear"></div>          
        </div>
       </div>
       <div class="bottom-alt"></div>
    </div>
 </div>
</div>